#ifndef	__XML_REF_XMLNAMETABLE_H__
#define	__XML_REF_XMLNAMETABLE_H__

#include "../REFXMLName.h"

namespace BFX
{

class REFXMLDocument;
class REFNameTable;

class REFXMLNameTable : public REFObject
{
	// the hash entry.
	struct Entry : public REFObject
	{
		REF<REFXMLName>	m_pXmlName;
		int		m_nHashCode;
		REF<Entry>	m_pNext;
		Entry(REFXMLName* pXmlName, int nHashCode, Entry* pNext)
		{
			m_pXmlName = pXmlName;
			m_nHashCode = nHashCode;
			m_pNext = pNext;
		}
	};
public:
	REFXMLNameTable(REFXMLDocument* pDoc);
	virtual ~REFXMLNameTable();

	REFXMLName* AddName(const UniString& strPrefix, const UniString& strLocalName, const UniString& strNs);
	REFXMLName* GetName(const UniString& strPrefix, const UniString& strLocalName, const UniString& strNs);
	void Clear();

private:
	static const int HASH_MASK	= 0x3f;	// 64 - 1

	REF<Entry>*	m_pBuckets;
	int	m_nSize;

	REFXMLDocument*	m_pOwnerDocument;
	REFNameTable*	m_pNameTable;
};

}	//	namespace BFX

#endif	//	__XML_REF_XMLNAMETABLE_H__
